<?php

/**
 * sfFormGuiResponse actions.
 *
 * @package    plugintest
 * @subpackage sfFormGuiResponse
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
 */
class sfFormGuiResponseActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex($request)
  {
    $this->forward('default', 'module');
  }
  
  public function executeDelete($request)
  {
    $response = sfFormGuiResponseQuestionPeer::retrieveByPk($request->getParameter('id'));
    $this->forward404Unless($response);
    if(file_exists(sfConfig::get('sf_upload_dir').'/'.$response->getValue())) {
        unlink(sfConfig::get('sf_upload_dir').'/'.$response->getValue());
    }
    $response->delete();
    return $this->redirect('sfFormGui/show?id='.$response->getSfFormGuiQuestion()->getSfFormGui()->getId());
  }
}
